package com.yc.navy.springmvc.controller;

import java.util.List;

import javax.servlet.http.HttpSession;

import com.yc.navy.springmvc.bean.UserInfo;
import com.yc.navy.springmvc.core.annotation.Autowired;
import com.yc.navy.springmvc.core.annotation.Controller;
import com.yc.navy.springmvc.core.annotation.GetMapping;
import com.yc.navy.springmvc.core.annotation.PostMapping;
import com.yc.navy.springmvc.core.annotation.RequestMapping;
import com.yc.navy.springmvc.core.annotation.RequestParam;
import com.yc.navy.springmvc.core.annotation.ResponseBody;
import com.yc.navy.springmvc.service.IUserInfoService;



@Controller	//说明这是一个控制层
@RequestMapping("/user")
public class UserInfoController {
	@Autowired
	private IUserInfoService userInfoService;
	
	@PostMapping("/list")
	@ResponseBody	//以数据方法返回，如果是对象默认会以json格式，如果
	public List<UserInfo> list(String uname, String pwd, HttpSession session){
		System.out.println(uname + "\t" + pwd + "\t" + session);
		return userInfoService.list();
	}
	
	@GetMapping("/find")
	@ResponseBody	//以数据方法返回，如果是对象默认会以json格式，如果
	public String find(@RequestParam("id") String usid){
		return "redirect:../success.html";
	}
}
